package com.canyou.common;

import com.canyou.util.DateUtil;
import com.jfinal.plugin.activerecord.Model;

public abstract class CanYouModel<M extends Model<M>> extends Model<M> {

	private static final long serialVersionUID = 4597673659231174970L;

	/**
	 * 保存并记录新增时间和新增人
	 * 
	 * @author cgz 2012-12-29
	 * @param userName
	 * @return
	 */
	public boolean save(String userName) {
		set("CreatedOn", DateUtil.today());
		set("CreatedBy", userName);
		return super.save();
	}

	/**
	 * 修改并记录修改时间和修改人
	 * 
	 * @author cgz 2012-12-29
	 * @param userName
	 * @return
	 */
	public boolean update(String userName) {
		set("ModifiedOn", DateUtil.today());
		set("ModifiedBy", userName);
		return super.save();
	}
}
